<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<html>
<head>
<!-- 声明文档使用的字符编码 -->
 
<!-- 优先使用 IE 最新版本和 Chrome -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>

<!-- 为移动设备添加 viewport -->
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=3,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
<!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->

<!-- iOS 设备 begin -->
<meta name="apple-mobile-web-app-title" content="标题">
<!-- 添加到主屏后的标题（iOS 6 新增） -->
<meta name="apple-mobile-web-app-capable" content="yes"/>
<!-- 是否启用 WebApp 全屏模式，删除苹果默认的工具栏和菜单栏 -->

<!--meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL" -->
<!-- 添加智能 App 广告条 Smart App Banner（iOS 6+ Safari） -->
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<!-- 设置苹果工具栏颜色 -->
<meta name="format-detection" content="telphone=no, email=no"/>
<!-- 忽略页面中的数字识别为电话，忽略email识别 -->

<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 不让百度转码 -->
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ强制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!-- iOS 图标 begin -->
<link rel="apple-touch-icon-precomposed" href="/apple-touch-icon-57x57-precomposed.png"/>
<!-- iPhone 和 iTouch，默认 57x57 像素，必须有 -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-114x114-precomposed.png"/>
<!-- Retina iPhone 和 Retina iTouch，114x114 像素，可以没有，但推荐有 -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144x144-precomposed.png"/>
<!-- Retina iPad，144x144 像素，可以没有，但推荐有 -->
<!-- iOS 图标 end -->

<!-- iOS 启动画面 begin -->
<link rel="apple-touch-startup-image" sizes="768x1004" href="img/App-ios-logo-152x152.png"/>
<!-- iPad 竖屏 768 x 1004（标准分辨率） -->
<link rel="apple-touch-startup-image" sizes="1536x2008" href="img/App-ios-logo-152x152.png"/>
<!-- iPad 竖屏 1536x2008（Retina） -->
<link rel="apple-touch-startup-image" sizes="1024x748" href="img/App-ios-logo-152x152.png"/>
<!-- iPad 横屏 1024x748（标准分辨率） -->
<link rel="apple-touch-startup-image" sizes="2048x1496" href="img/App-ios-logo-152x152.png"/>
<!-- iPad 横屏 2048x1496（Retina） -->

<link rel="apple-touch-startup-image" href="img/App-ios-logo-152x152.png"/>
<!-- iPhone/iPod Touch 竖屏 320x480 (标准分辨率) -->
<link rel="apple-touch-startup-image" sizes="640x960" href="img/App-ios-logo-152x152.png"/>
<!-- iPhone/iPod Touch 竖屏 640x960 (Retina) -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="img/App-ios-logo-152x152.png"/>
<!-- iPhone 5/iPod Touch 5 竖屏 640x1136 (Retina) -->
<!-- iOS 启动画面 end -->

<!-- iOS 设备 end -->
<meta name="msapplication-TileColor" content="#000"/>
<!-- Windows 8 磁贴颜色 -->
<meta name="msapplication-TileImage" content="icon.png"/>
<!-- Windows 8 磁贴图标 -->

<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml"/>
<!-- 添加 RSS 订阅 -->
<link rel="shortcut icon" type="image/ico" href="/favicon.ico"/>
<!-- 添加 favicon icon -->
<!-- sns 社交标签 begin -->
<!-- 参考微博API -->
<meta property="og:type" content="类型" />
<meta property="og:url" content="URL地址" />
<meta property="og:title" content="标题" />
<meta property="og:image" content="图片" />
<meta property="og:description" content="描述" />
<!-- sns 社交标签 end -->
<title>量体数据查询</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/common.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/font.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/header.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/footer.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/index.css">
<link rel="stylesheet" href="${pageContext.request.contextPath }/wc/css/responsive.css">
<style type="text/css">
button {background: #B4CDCD;font-size:14px;}
 
</style>

<script type="text/javascript" src="${pageContext.request.contextPath }/wc/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/wc/js/swipe-min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/wc/js/common.js"></script>
<script type="text/javascript">

$(function(){
	main();
});

 

function main(){
	
	//判断页面来源，若是来源模板消息，则直接执行doSwich
	//若是来源按钮，则显示历史列表
	var customerID = GetQueryString("customerID");
	var fromWhere = GetQueryString("fromWhere");
	//alert(fromWhere)
	 
	if(fromWhere=='mobanxiaoxi'){
		doSwich(customerID);
 	}else if(fromWhere=='pressbutton'){
		
		doSearch();
	}
}

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}

function doSwich(customerID){
	$.post("${pageContext.request.contextPath}/customer/page.everyone.queryScanDataByCustomerId.ashx?customerID="+customerID,function(result){
		
		if(result.status == "1"){
			// 成功
			$('#dataol').empty();
			 
 			
			var scandataMap = result.scandataMap;
			
 			var flag = 0;
 			$.each(scandataMap,function(key,values){ 
 				flag=1;
 				$('#dataol').append('<li>'+key+":"+'</li>');     
 			    $(values).each(function(){ 
 			    	var item = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + this.typename+':'+this.shuzhi;    
 			    	$('#dataol').append('<li>'+item+'</li>');    
 			    });     
 			 }); 
			
			
			if(flag==0){
				$('#dataol').append('<li style="text-align:center;">数据暂未同步，请稍后再试，感谢您的理解！</li>');
 			}else{
 				if(result.data.bmiTest){
 					$('#dataol').append('<li>'+result.data.bmiTest+'</li>');
 				}
 				
 			}
			if(GetQueryString("fromWhere")=="pressbutton"){
				$('#dataol').append('<li id= "returnli" style="text-align:center;" onClick="doReturn()">返回历史列表</li>');
			}
  			
 			
			
 			$('#historydiv').hide();
			$('#datadiv').show();
		}else{
			
			alert('查询失败');
		}
			
	}); 
	
}

	function doReturn(){
	$('#historydiv').show();
	$('#datadiv').hide();
	}
	
	
	function doSearch(){
		var code = GetQueryString("code");
		//alert("code"+code)
		$.post("${pageContext.request.contextPath}/customer/page.everyone.getCustomerHistoryEventItem.ashx?code="+code,function(result){
			
			if(result.status == "1"){
				// 成功
				$('#historyol').empty();
 				var customerList = result.data;
				for (var int = 0; int < customerList.length; int++) {
					var item = customerList[int].customerName+'&nbsp;&nbsp;<font style="font-size:10px">'+formatterDate(customerList[int].cUploadTime)+"</font>";
					$('#historyol').append('<li onClick ="doSwich('+customerList[int].customerID+')">'+item+'</li>');
					
				}
				if(customerList.length==0){
					$('#historyol').append('<li style="text-align:center;">没有数据</li>');
				}
				
				$('#historydiv').show();
				$('#datadiv').hide();
			}else{
				
				alert('查询失败');
			}
				
		}); 
		
		
	}
	
	function formatterDate(value){
		if(value==''||null==value){
			return '';
		}
		var now = new Date(value);  
		var year=now.getYear()+1900; 
		var month=now.getMonth()+1; 
		var date=now.getDate(); 
		var hour=now.getHours(); 
		var minute=now.getMinutes();
		minute= (minute > 9) ? minute=minute : minute='0'+minute;
		//var second=now.getSeconds(); 
		return year+"-"+month+"-"+date+" "+hour+":"+minute; 
	}
</script>
</head>

<body ontouchstart="return true;">

	<!--头部-->
	<header>
		<div class="header">
			<h1>量体数据查询</h1>
			
		</div>
	</header>
	
	<!--内容区-->
	<!--内容区-->
	<article class="main-container">
		
	<!-- 	<div class="invite-content">
			<p class="line" style="font-size:10px;text-align:center;"><br>您可以通过手机号查询您的历史量体记录，然后点击量体记录查看量体数据。<br><br><a href=""></a></p>
			<p class="line" style="text-align:center;">
				<b style="font-size:12px;">手机号:</b>
				<input type="text" id="phone" class="line" /><button  onClick="doSearch()"  >&nbsp;&nbsp;查&nbsp;&nbsp;询&nbsp;&nbsp;</button>
			</p>
		</div> -->
		
		<div id="historydiv" class="list" hidden="hidden">
			<div class="title"> 量体历史记录: </div>
			<ol id="historyol" class="line">
				<li onClick ="doSwich()">郭小帅|2017-8-24</li>
				<li >笑就歌颂|2017-8-24</li>
				<li >天空|2017-8-24</li>
			</ol>
		</div>
		
		<div id="datadiv"  class="list" hidden="hidden">
			<div class="title"> 量体数据: </div>
			<ol id="dataol" class="line">
				<li >大衣-身高-170_0</li>
				<li >大衣-身高-170_0</li>
				<li >大衣-身高-170_0</li>
				<li onClick="doReturn()">返回</li>
			</ol>
		</div>
		
	</article>

</body>
</html>

